home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d13
/
patch12.arc
/
TCPATCH5.DIF
< prev
next >
Wrap
Text File
|
1990-10-02
|
4KB
|
175 lines
TurboC2.0 Patches to fix pipe bugs
Prereq: 4
*** tcpatlev.h Wed Jul 18 15:48:16 1990
--- tcpatlev.new Tue Aug 07 08:31:10 1990
***************
*** 1,1 ****
! #define TCPATCHLEVEL 4
--- 1,1 ----
! #define TCPATCHLEVEL 5
*** readme Wed Jul 18 15:39:48 1990
--- readme.new Tue Aug 07 08:31:10 1990
***************
*** 182,184 ****
--- 182,201 ----
in the current implementation.
(this bug is now fixed)
+
+
+ *** OFFICIAL PATCHLEVEL 12, TurboC2.0 PATCHLEVEL 5
+
+ From: aas@cc.uq.oz.au (Alex Sergejew)
+ Date: Fri, 20 Jul 90 23:56:13 EST
+
+ The problem is that whatever ed is doing it's not accepting the
+ redirected stdin from the shelled COMMAND.COM and so it stalls. When you
+ hit q it unstalls and also returns normally but hasn't read the ed script.
+
+ Appended find *more* patches, this time to a pipe package that *does* work
+ the way it ought to, along with appropriate mods to pch.c and makefile
+ (ie patches to my patches to your patches to etc). The pipe package here
+ was snarfed from an old edition of lharc and is more limited than the fancy
+ one I posted but it works just fine with patch (it does stdin redirection
+ from the invocation of the spawned COMMAND.COM - quite foolproof).
*** makefile.bak Sun Jul 15 15:59:34 1990
--- makefile Fri Jul 20 21:54:12 1990
***************
*** 1,14 ****
CC = tcc
CFLAGS = -N -ml -DTURBOC20
! c = patch.c pch.c inp.c version.c util.c popen.c getswitc.c
! obj = patch.obj pch.obj inp.obj version.obj util.obj popen.obj getswitc.obj
.c.obj:
$(CC) -c $(CFLAGS) $(LARGE) $*.c
patch.exe: $(obj)
! $(CC) -epatch $(CFLAGS) $(obj)
patch.obj: config.h common.h patch.c inp.h pch.h util.h version.h
--- 1,17 ----
CC = tcc
CFLAGS = -N -ml -DTURBOC20
+ LFLAGS = -ml
! #c = patch.c pch.c inp.c version.c util.c popen.c getswitc.c
! #obj = patch.obj pch.obj inp.obj version.obj util.obj popen.obj getswitc.obj
! c = patch.c pch.c inp.c version.c util.c pipes.c
! obj = patch.obj pch.obj inp.obj version.obj util.obj pipes.obj
.c.obj:
$(CC) -c $(CFLAGS) $(LARGE) $*.c
patch.exe: $(obj)
! $(CC) -epatch $(LFLAGS) $(obj)
patch.obj: config.h common.h patch.c inp.h pch.h util.h version.h
*** pch.bak Sun Jul 15 18:54:58 1990
--- pch.c Fri Jul 20 22:17:22 1990
***************
*** 41,49 ****
#include "util.h"
#include "INTERN.h"
#include "pch.h"
- #ifdef TURBOC20
- #include "popen.h"
- #endif
/* Patch (diff listing) abstract type. */
--- 41,46 ----
*** /dev/null
--- pipes.c Fri Jul 20 21:52:54 1990
***************
*** 0 ****
--- 1,84 ----
+ /* a simulation for the Unix popen() and pclose() calls on MS-DOS */
+ /* only one pipe can be open at a time */
+
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <io.h>
+
+ static char pipename[128], command[128];
+ static int wrpipe;
+
+ static void Mktemp(char *);
+
+ FILE *popen(char *cmd, char *flags)
+ {
+ wrpipe = (strchr(flags, 'w') != NULL);
+
+ if ( wrpipe )
+ {
+ strcpy(command, cmd);
+ strcpy(pipename, "~WXXXXXX");
+ Mktemp(pipename);
+ return fopen(pipename, flags); /* ordinary file */
+ }
+ else
+ {
+ strcpy(pipename, "~RXXXXXX");
+ Mktemp(pipename);
+ strcpy(command, cmd);
+ strcat(command, ">");
+ strcat(command, pipename);
+ system(command);
+ return fopen(pipename, flags); /* ordinary file */
+ }
+ }
+
+ int pclose(FILE *pipe)
+ {
+ int rc;
+
+ if ( fclose(pipe) == EOF )
+ return EOF;
+
+ if ( wrpipe )
+ {
+ if ( command[strlen(command) - 1] == '!' )
+ command[strlen(command) - 1] = 0;
+ else
+ strcat(command, "<");
+
+ strcat(command, pipename);
+ rc = system(command);
+ unlink(pipename);
+ return rc;
+ }
+ else
+ {
+ unlink(pipename);
+ return 0;
+ }
+ }
+
+ static
+ void Mktemp(char *file)
+ {
+ char fname[32], *tmp, *bsp;
+
+ tmp = getenv("TMP");
+
+ if ( tmp != NULL )
+ {
+ strcpy(fname, file);
+ bsp = strcpy(file, tmp);
+ while ((bsp=strchr(bsp, '/')) != NULL)
+ *bsp = '\\';
+
+ if ( file[strlen(file) - 1] != '\\' )
+ strcat(file, "\\");
+
+ strcat(file, fname);
+ }
+
+ mktemp(file);
+ }